import {makeAutoObservable} from "mobx"

class UserStore{
  isLogin = false
  token = ""
  user = {
    name: "",
    id: "",
  }
  constructor() {
    makeAutoObservable(this)
  }
  login(user) {
    this.isLogin = true
    this.token = user.token
    this.user = {
      name: user.name,
      id: user.id,
    }
  }
  logout() {
    this.isLogin = false
    this.token = ""
    this.user = {
      name: "",
      id: "",
    }
  }
}

export default new UserStore()